

import tkinter as tk

root = tk.Tk()
root.title("用户登录")
root.geometry("300x200")
iframe = tk.Frame(root, width=300, height=200, relief='ridge')
iframe.pack(padx=10, pady=30)
name_label = tk.Label(iframe, text="用户名：")
name_entry = tk.Entry(iframe)
pwd_label = tk.Label(iframe, text="密码：" ,padx=10)
pwd_entry = tk.Entry(iframe, show="*")
login_button = tk.Button(iframe, text="登录",width=10)
name_label.grid(row=0, column=0, sticky="e")
name_entry.grid(row=0, column=1, sticky="w")
pwd_label.grid(row=1, column=0, sticky="e")
pwd_entry.grid(row=1, column=1, sticky="w")
#login_button居中显示
login_button.grid(row=2, column=0, columnspan=2)



# 登录成功提示




root.mainloop()

